home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / ifl / IFL.z / IFL
Encoding:
Text File  |  1998-10-20  |  31.2 KB  |  661 lines

  1.  
  2.  
  3.  
  4. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      IIIIFFFFLLLL - overview of Image Format Library
  10.  
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      The Image Format Library (IFL) is a library for opening, reading, writing
  14.      and creating image files in a format independent manner. IFL consists of
  15.      a library developed in C++. An interface library for C programmers is
  16.      also provided.  IFL includes support for the FIT, GIF, JFIF, Photo CD,
  17.      PNG, PPM, SGI, TIFF and numerous other file formats.  It also supports
  18.      reading and writing raw image data in a fairly flexible manner.  It is
  19.      designed to be very easy to use with a straight-forward mechanism support
  20.      user-defined file formats.
  21.  
  22.  
  23. GGGGEEEETTTTTTTTIIIINNNNGGGG SSSSTTTTAAAARRRRTTTTEEEEDDDD
  24.      To open a file and read it into memory you can write C++ code like the
  25.      following:
  26.  
  27.           #include <ifl/iflFile.h>
  28.  
  29.           // open the file named by 'filename'
  30.  
  31.           iflStatus sts;
  32.           iflFile* file = iflFile::open(filename, O_RDONLY, &sts);
  33.           if (sts != iflOKAY) { /* handle the error */ }
  34.  
  35.           // read the entire image (just the first plane in z if image has depth)
  36.           // into a buffer of unsiged chars
  37.  
  38.           iflSize dims;
  39.           file->getDimensions(dims);
  40.           unsigned char* data = new unsigned char[dims.x*dims.y*dims.c];
  41.           iflConfig cfg(iflUChar, iflInterleaved);
  42.           sts = file->getTile(0, 0, 0, dims.x, dims.y, 1, data, &cfg);
  43.           if (sts != iflOKAY) { /* handle error */ }
  44.  
  45.           // close the file
  46.           file->close();
  47.  
  48.  
  49.      or equivalently in C you could write:
  50.  
  51.           #include <ifl/iflCdefs.h>
  52.  
  53.           /* open the file named by 'filename' */
  54.  
  55.           iflStatus sts;
  56.           iflFile *file;
  57.           iflSize dims;
  58.           unsigned char *data;
  59.           iflConfig* cfg;
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  71.  
  72.  
  73.  
  74.           file = iflFileOpen(filename, O_RDONLY, &sts);
  75.           if (sts != iflOKAY) { /* handle the error */ }
  76.  
  77.           /*
  78.               read the entire image (just the first plane in z if image
  79.               has depth) into a buffer of unsiged chars
  80.           */
  81.  
  82.           iflFileGetDimensions(file, &dims);
  83.           data = (unsigned char*)malloc(dims.x*dims.y*dims.c);
  84.           cfg = iflConfigCreate(iflUChar, iflInterleaved, 0, NULL, 0, 0);
  85.           sts = iflFileGetTile(file, 0, 0, 0, dims.x, dims.y, 1, data, cfg);
  86.           if (sts != iflOKAY) { /* handle error */ }
  87.  
  88.           /* close the file */
  89.           iflFileClose(file, 0);
  90.  
  91.  
  92.      This simple example opens a file in any image format supported by IFL.
  93.      The open function returns a pointer to an iflFile object which is IFL's
  94.      abstraction for accessing image files. This object is described further
  95.      below and in the iflFile(3) man page. The file object is then used to
  96.      read the image's data it into memory. The iflConfig object is used to
  97.      specify that that data should be read in the file's _o_r_i_e_n_t_a_t_i_o_n, but with
  98.      the pixels forced to unsigned char format and _i_n_t_e_r_l_e_a_v_e_d ordering.
  99.  
  100.      Creating and writing an image file is just as simple:
  101.  
  102.           // create a one-channel, unsigned char image file
  103.           iflSize dims(width, height, 1);
  104.           iflFileConfig fc(&dims, iflUChar);
  105.           iflStatus sts;
  106.           iflFile* file = iflFile::create(filename, NULL, &fc, NULL, &sts);
  107.           if (sts != iflOKAY) { /* handle the create error */ }
  108.  
  109.           // write a tile of data to it
  110.           sts = file->setTile(0, 0, 0, width, height, 1, data);
  111.           if (sts != iflOKAY) { /* handle error */ }
  112.  
  113.           // make sure the data gets written out to disk (or you can close here)
  114.           sts = file->flush();
  115.           if (sts != iflOKAY) { /* handle error */ }
  116.  
  117.  
  118.      or equivalently in C you could write:
  119.  
  120.           iflFile *file;
  121.           iflFileConfig *fc;
  122.           iflStatus sts;
  123.           iflSize dims;
  124.  
  125.           /* create a one-channel, unsigned char image file */
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  137.  
  138.  
  139.  
  140.           dims.x = width;
  141.           dims.y = height;
  142.           dims.z = 1;
  143.           dims.c = 1;
  144.           fc = iflFileConfigCreate(&dims, iflUChar, 0, 0, 0, 0, NULL);
  145.           file = iflFileCreate(filename, NULL, fc, NULL, &sts);
  146.           if (sts != iflOKAY) { /* handle the create error */ }
  147.  
  148.           /* write a tile of data to it */
  149.           sts = iflFileSetTile(file, 0, 0, 0, width, height, 1, data, NULL);
  150.           if (sts != iflOKAY) { /* handle error */ }
  151.  
  152.           /* make sure the data gets written out to disk (or you can close here) */
  153.           sts = iflFileFlush(file);
  154.           if (sts != iflOKAY) { /* handle error */ }
  155.  
  156.  
  157.      The code fragment above creates a one-channel file with the specified
  158.      width and height and unsigned char data type.  The rest of the attributes
  159.      default to a format-preferred value.  The file format will be inferred
  160.      from the file name suffix.  (It is also possible to explicitly give a
  161.      format, and to inherit attributes from another iflFile.)  This example
  162.      then writes a tile of data to the file.  It assumes the data buffer is
  163.      the size and data type as the image created. It is also possible to do
  164.      automatic conversion on the sssseeeettttTTTTiiiilllleeee() operation.  Always be sure to flush
  165.      or close the file when you are done writing data to it or the disk file
  166.      may not be correctly written.
  167.  
  168.      Be aware that IFL doesn't scale the data when converting data types, so
  169.      you'd better be sure to pick a data type large enough to hold the range
  170.      of data values in the image file; you can use the ggggeeeettttSSSSccccaaaalllleeeeMMMMiiiinnnnMMMMaaaaxxxx() and
  171.      ggggeeeettttSSSSttttaaaattttMMMMiiiinnnnMMMMaaaaxxxx() methods of iflFile to check the range of values.  Also,
  172.      IFL doesn't do any color model conversions; if you need that level of
  173.      functionality you may want to use the ImageVision Library (IL) that is
  174.      layered on top of IFL.
  175.  
  176.      The following section on image attributes defines some of the terms just
  177.      used such as _o_r_i_e_n_t_a_t_i_o_n and _d_i_m_e_n_s_i_o_n _o_r_d_e_r_i_n_g.
  178.  
  179.  
  180.    EEEExxxxaaaammmmpppplllleeee ssssoooouuuurrrrcccceeee
  181.      If you install ifl_dev.sw.gifts, you can examine the source code provided
  182.      in /_u_s_r/_s_h_a_r_e/_s_r_c/_i_f_l/_a_p_p_s for more examples of using IFL.
  183.  
  184.  
  185. IIIIMMMMAAAAGGGGEEEE AAAATTTTTTTTRRRRIIIIBBBBUUUUTTTTEEEESSSS
  186.      The Image Format Library characterizes images according to the common
  187.      attributes described in the following sections.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  203.  
  204.  
  205.  
  206.    IIIImmmmaaaaggggeeee ssssiiiizzzzeeee
  207.      Image have four dimensions: _x, _y, _z, and _c.  The x and y dimensions are
  208.      typically the width and height of the image although their interpretation
  209.      is dependent upon the _o_r_i_e_n_t_a_t_i_o_n of the image (described below).
  210.  
  211.      The z dimension is generally interpreted as either depth for volume
  212.      images or time for image sequences like movies; for 2D images the size of
  213.      the z dimension is one.
  214.  
  215.      The c dimension is the channel or component dimension; the size of the c
  216.      dimension is the number of components in each pixel.  The size of the c
  217.      dimension must match the _c_o_l_o_r _m_o_d_e_l (see below) of the image.  For
  218.      example, an RGB image must have a c size of three and a greyscale image
  219.      must have a c size of one.  The only exception is the multi-spectral
  220.      color model which can have any size for the c dimension.  The image size
  221.      is represented by the _i_f_l_S_i_z_e structure defined in <_i_f_l/_i_f_l_S_i_z_e._h>.
  222.  
  223.  
  224.    DDDDaaaattttaaaa ttttyyyyppppeeee
  225.      The data type of an IFL image is the data type of the individual
  226.      components of each pixel.  All components of a pixel must have the same
  227.      data type.  The library supports nine data types: bit, signed byte,
  228.      unsigned byte, signed short (16 bits), unsigned short, signed long (32
  229.      bits), unsigned long, float (32 bits) and double (64 bits).  These data
  230.      types are encoded by the _i_f_l_D_a_t_a_T_y_p_e enum defined in <_i_f_l/_i_f_l_T_y_p_e_s._h>.
  231.      Typically, if a format actually stores data in say 4 bits per component
  232.      the IFL interface to the file will present the data as unsigned char with
  233.      a scaling range of 0-15 (see below).
  234.  
  235.      For a color palette image (see Color model section below), the image's
  236.      data type refers to the type of its color index.  The type of the color
  237.      map values is determined by the file format and stored in an iflColormap.
  238.  
  239.  
  240.    DDDDiiiimmmmeeeennnnssssiiiioooonnnn oooorrrrddddeeeerrrr
  241.      This is the relative ordering of the image's x, y and channel dimensions.
  242.      There are three orderings supported by IFL:
  243.  
  244.           _i_n_t_e_r_l_e_a_v_e_d   channel dimension varies fastest, then x, then y, z
  245.                         last; thus all the components of each pixel are
  246.                         grouped together
  247.  
  248.           _s_e_q_u_e_n_t_i_a_l    x dimension varies fastest, then channels, then y, z
  249.                         last; all the components of a single row are grouped
  250.                         together (seldom used)
  251.  
  252.           _s_e_p_a_r_a_t_e      x dimension varies fastest, then y, then channels, z
  253.                         last; the data is stored with each component isolated
  254.                         in a separate plane.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  269.  
  270.  
  271.  
  272.      These orderings are encoded by the _i_f_l_O_r_d_e_r enum defined in
  273.      <_i_f_l/_i_f_l_T_y_p_e_s._h>.
  274.  
  275.  
  276.    CCCCoooolllloooorrrr mmmmooooddddeeeellll
  277.      The color model of an image defines the interpretation of the components
  278.      of its pixels.  There are 11 color models supported by IFL: greyscale,
  279.      inverted greyscale (minimum is white, maximum is black), greyscale plus
  280.      alpha, color palette (indicies mapped through a color map), RGB triplets,
  281.      RGB plus alpha, HSV, CMY, CMYK, YCC and multi-spectral.  There are also
  282.      component reversed versions of RGB and RGBA but their use is deprecated
  283.      (they are for backward compatibility with older SGI systems).  These
  284.      color models are encoded by the _i_f_l_C_o_l_o_r_M_o_d_e_l enum defined in
  285.      <_i_f_l/_i_f_l_T_y_p_e_s._h>.
  286.  
  287.  
  288.    OOOOrrrriiiieeeennnnttttaaaattttiiiioooonnnn
  289.      The orientation of an image defines the spatial interpretation of its x
  290.      and y dimensions.  It is defined in terms of the location of the origin
  291.      of the image (one of the four corners) and the direction of the x and y
  292.      dimension (whether x runs horizontally or vertically).  The combination
  293.      of these two factors yields the eight orientations supported by IFL:
  294.  
  295.           _u_p_p_e_r-_l_e_f_t    origin in upper-left corner, x dimension is horizontal
  296.                         (y is vertical)
  297.  
  298.           _u_p_p_e_r-_r_i_g_h_t   origin in upper-right corner, x dimension is
  299.                         horizontal
  300.  
  301.           _l_o_w_e_r-_l_e_f_t    origin in lower-left corner, x dimension is horizontal
  302.  
  303.           _l_o_w_e_r-_r_i_g_h_t   origin in lower-right corner, x dimension is
  304.                         horizontal
  305.  
  306.           _l_e_f_t-_u_p_p_e_r    origin in upper-left corner, x dimension is vertical
  307.                         (y is horizontal)
  308.  
  309.           _r_i_g_h_t-_u_p_p_e_r   origin in upper-right corner, x dimension is vertical
  310.  
  311.           _r_i_g_h_t-_l_o_w_e_r   origin in lower-right corner, x dimension is vertical
  312.  
  313.           _l_e_f_t-_l_o_w_e_r    origin in lower-left corner, x dimension is vertical
  314.  
  315.      These orientations are encoded by the iflOrientation enum defined in
  316.      <_i_f_l/_i_f_l_T_y_p_e_s._h>.
  317.  
  318.  
  319.    CCCCoooommmmpppprrrreeeessssssssiiiioooonnnn
  320.      The data in an image file may be compressed (depending on the format).
  321.      Each format supported by IFL will automatically decompress the data read
  322.      from the file when it is accessed through the iflFile methods ggggeeeettttPPPPaaaaggggeeee()
  323.      and ggggeeeettttTTTTiiiilllleeee().  Similarly, each format will compress data passed to the
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  335.  
  336.  
  337.  
  338.      sssseeeettttPPPPaaaaggggeeee() and sssseeeettttTTTTiiiilllleeee() methods before it is written out.  The
  339.      compressions are encoded in the _i_f_l_C_o_m_p_r_e_s_s_i_o_n enum defined in
  340.      <_i_f_l/_i_f_l_T_y_p_e_s._h>.
  341.  
  342.  
  343.    PPPPaaaaggggeeee ssssiiiizzzzeeee
  344.      Some images are stored in a paged manner, others are stored in horizontal
  345.      strips, others may not allow random access at all.  Each file format
  346.      encodes the underlying structure of its data with the page size
  347.      attribute. The page size defines the dimensions of the natural chunks
  348.      that an application can access with the getPage() and setPage() methods
  349.      of iflFile.  For arbitrarily paged images the x and y page size may be
  350.      smaller than the image's x and y size, requiring multiple fixed-size
  351.      pages to be tiled across the image.  For strip oriented images the page
  352.      width will be the same as the image width and the strips will be stacked
  353.      vertically to cover the image.  For images that can't support random
  354.      access to pages of fixed size, the page size will be the same as the
  355.      image size; i.e. there will only be one page.
  356.  
  357.      The page size is defined by x, y, z and c dimensions as with the image
  358.      size and follows the same rules with respect to the image's orientation.
  359.      Data within each page is packed; there is no padding at the end of each
  360.      line, even for bit data.  Some file formats may indicate such padding by
  361.      having the page size wider that the image size.
  362.  
  363.  
  364.    DDDDiiiissssppppllllaaaayyyy ssssccccaaaalllliiiinnnngggg rrrraaaannnnggggeeee
  365.      Some image formats store a notion of the range of component values for
  366.      purposes of scaling the data for display.  This attribute may not be
  367.      present in an image, in which case the application should assume the
  368.      range is the full range of values than can be represented by the image's
  369.      component data type.  For images whose color model is iflRGBpalette this
  370.      is the range of the entries on the color map, not the indices.
  371.  
  372.  
  373.    SSSSttttaaaattttiiiissssttttiiiiccccaaaallll rrrraaaannnnggggeeee
  374.      Some image formats store a notion of the statistical range of component
  375.      values.  This range should not be used for display scaling purposes, but
  376.      may be useful in some image processing computations.
  377.  
  378.  
  379.    IIIICCCCCCCC pppprrrrooooffffiiiilllleeeessss
  380.      Some image formats store an ICC (International Color Consortium) profile
  381.      that can be used for color management.  See _h_t_t_p://_w_w_w._c_o_l_o_r._o_r_g for more
  382.      details on the specifics of how such profiles are used.
  383.  
  384.  
  385. TTTTHHHHEEEE IIIIMMMMAAAAGGGGEEEE FFFFIIIILLLLEEEE AAAABBBBSSSSTTTTRRRRAAAACCCCTTTTIIIIOOOONNNN
  386.      IFL's mechanism for accessing image files is through the iflFile class.
  387.      This class is used as a base for deriving all of the file formats
  388.      supported by IFL. It provides static methods to open existing image files
  389.      and to create new ones.  It provides methods to read and write image
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  401.  
  402.  
  403.  
  404.      data, query all attributes and set some attributes.  Format specific
  405.      operations are supported through the ggggeeeettttIIIItttteeeemmmm() and sssseeeettttIIIItttteeeemmmm() methods.
  406.      Because of this base abstraction, IFL enables applications to be written
  407.      that are image file format independent, yet still allows full access to
  408.      unique attributes and capabilities of particular file formats.  Refer to
  409.      the iflFile(3) man page for more details.
  410.  
  411.  
  412. TTTTHHHHEEEE IIIIMMMMAAAAGGGGEEEE FFFFOOOORRRRMMMMAAAATTTT AAAABBBBSSSSTTTTRRRRAAAACCCCTTTTIIIIOOOONNNN
  413.      The Image Format Library uses the iflFormat object to represent a
  414.      description of the capabilities of a particular image file format. The
  415.      iflFormat class provides a number of functions that can be used to look
  416.      up formats by format name, by a file's "magic" number, or by file name
  417.      extension (e.g. ".gif").  There is also a method to iterate through all
  418.      available formats ( useful for user interfaces, for instance, to generate
  419.      a menu of available file formats).
  420.  
  421.      The methods on an iflFormat allow the user to determine which values of
  422.      the image attributes are supported by that format.  There are also
  423.      methods to query the preferred values of those attributes.  See the
  424.      iflFormat(3) man page for more details.
  425.  
  426.  
  427. AAAADDDDDDDDIIIINNNNGGGG NNNNEEEEWWWW IIIIMMMMAAAAGGGGEEEE FFFFIIIILLLLEEEE FFFFOOOORRRRMMMMAAAATTTTSSSS
  428.      To add support for a new image file format, you create a Dynamic Shared
  429.      Object (DSO) that implements the format and add an entry in the IFL file
  430.      format database for the format.
  431.  
  432.      The DSO implements the file format I/O itself and the IFL interface
  433.      abstraction.  This is often done by using an already existing file format
  434.      library and creating an IFL interface that makes calls into that library
  435.      (see the iflJFIFFile.c++ and iflTIFFFile.c++ examples in ifl_dev.sw.gifts
  436.      as examples of this).  The IFL interface is implemented by deriving
  437.      classes from iflFormat and iflFile for the format.  Refer to the
  438.      iflFile(3) and iflFormat(3) man pages for information on deriving your
  439.      own classes.
  440.  
  441.      IFL uses a text database file to determine what file formats are
  442.      available for use with IFL.  The database is normally located in the file
  443.      /usr/lib/ifl/ifl_database but this may be overridden with the
  444.      IIIIFFFFLLLL____DDDDAAAATTTTAAAABBBBAAAASSSSEEEE environment variable.
  445.  
  446.  
  447.      The database is generated by the /usr/lib/ifl/ifldbgen program when new
  448.      file formats are added to the system. To add you own file format, you
  449.      should create a database file with the new entry or entries and place
  450.      that file in the /usr/lib/ifl/database directory. Once there, running the
  451.      ifldbgen program will generate the updated database. Unlike previous
  452.      versions of IFL, you should not include an include directive in the new
  453.      database file.  Doing so will result in conflicts when ifldbgen creates
  454.      the new database.
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  467.  
  468.  
  469.  
  470.    BBBBuuuuiiiillllddddiiiinnnngggg yyyyoooouuuurrrr DDDDSSSSOOOO
  471.      There are two critical things that must be done when you build the DSO
  472.      for your file format.
  473.  
  474.           You must build your DSO using the C++ compiler so that the
  475.           statically declared iflFormat derived object (see the iflFormat(3)
  476.           man page for more info) will be automatically instantiated when the
  477.           DSO is dynamically opened by IFL.
  478.  
  479.           The DSO version string must be 'sgi2.0' for IFL 1.1 and IFL 1.2 to
  480.           recognize it as a valid file format DSO.
  481.  
  482.      An example command line to create a DSO for the TIFF format might be:
  483.  
  484.           % CC -mips3 -n32 -o libiflTIFF.so -set_version sgi2.0 -shared -all \
  485.                iflTIFFFile.o -ltiff -lifl -lm
  486.  
  487.      The DSO would then normally be installed in /_u_s_r/_l_i_b_3_2 or some other
  488.      directory that can be pointed to by the LD_LIBRARYN32_PATH environment
  489.      variable.  If you wish your file format to be useable with both -32 and
  490.      -n32 executables then you will need to build the DSO for each object
  491.      style and install them in the appropriate directories.  See the ld(1) and
  492.      rld(1) man pages for more details on DSO search paths.
  493.  
  494.  
  495.    FFFFoooorrrrmmmmaaaatttt ooooffff tttthhhheeee ddddaaaattttaaaabbbbaaaasssseeee ffffiiiilllleeee
  496.      IFL database files are text files made up of a list of "format"
  497.      declarations.  A format declaration looks like this:
  498.  
  499.           format _f_o_r_m_a_t_n_a_m_e
  500.             match          _m_a_t_c_h_r_u_l_e
  501.             description    "_h_u_m_a_n-_r_e_a_d_a_b_l_e _d_e_s_c_r_i_p_t_i_o_n _o_f _t_h_e _f_o_r_m_a_t"
  502.             dso            _n_a_m_e _o_f _D_S_O _f_i_l_e
  503.             access         _s_u_p_p_o_r_t_e_d _a_c_c_e_s_s _m_o_d_e_s
  504.             subsystem      _i_n_s_t _s_u_b-_s_y_s_t_e_m _c_o_n_t_a_i_n_i_n_g _t_h_e _D_S_O
  505.             suffixes       _c_o_m_m_a-_s_e_p_a_r_a_t_e_d _l_i_s_t _o_f _f_i_l_e _n_a_m_e _s_u_f_f_i_x_e_s
  506.  
  507.  
  508.      The format declaration must come first and declares the name of an image
  509.      file format.  A format name is a one-word string and can be any legal C-
  510.      language variable name.  Each format declaration must have a unique name.
  511.      All attribute declarations that follow a format declaration may appear in
  512.      any order and apply to that format until the next format declaration is
  513.      encountered in the database file.  The match, description, and dso
  514.      attribute declarations are required for every format.
  515.  
  516.      The _m_a_t_c_h declaration is a logical expression that determines whether a
  517.      particular file is of the declared format.  A _m_a_t_c_h rule consists of a
  518.      C-style logical expression made up of functions, comparison operators and
  519.      parentheses.  The following C-language operators may be used in a MATCH
  520.      expression:
  521.  
  522.  
  523.  
  524.  
  525.                                                                         PPPPaaaaggggeeee 8888
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  533.  
  534.  
  535.  
  536.           &&  ||  ==  !=  <  >  <=  >= ( )
  537.  
  538.      The == operator works for string comparisons as well as for numerical
  539.      expressions.
  540.  
  541.      Numbers in a match expression may be expressed in decimal, octal, or
  542.      hexadecimal notation.  Octal numbers are expressed with a leading zero,
  543.      such as 0732.  Hexadecimal numbers are expressed with a leading `0x' such
  544.      as 0xf03c.  Decimal number are expressed normally, but may not have a
  545.      leading zero.
  546.  
  547.      The following expression functions are available:
  548.  
  549.      char(_n)         Returns the signed byte located at offset _n in the file;
  550.                      range -128 to 127.
  551.  
  552.      long(_n)         Returns the signed long integer located at offset _n in
  553.                      the file; range -2^31 to 2^31-1.
  554.  
  555.      short(_n)        Returns the signed short integer located at offset _n in
  556.                      the file; range -32768 to 32767.
  557.  
  558.      string(_n,_l)     Returns the _l character long string located at offset _n
  559.                      in the file.
  560.  
  561.      uchar(_n)        Returns the unsigned byte located at offset _n in the
  562.                      file; range 0 to 255.
  563.  
  564.      ulong(_n)        Returns the unsigned long integer located at offset _n in
  565.                      the file; range 0 to 2^32-1.
  566.  
  567.      ushort(_n)       Returns the unsigned short integer located at offset _n in
  568.                      the file; range 0 to 65535.
  569.  
  570.      Typical match declaration examples are:
  571.  
  572.          match short(0) == 0x01da || short(0) == 0xda01
  573.  
  574.      or
  575.  
  576.          match long(0) == 0xffd8ffe0 && string(6,4) == "JFIF"
  577.  
  578.  
  579.      The description declaration is a human-readable description of the image
  580.      format.  Typical description declaration examples are:
  581.  
  582.          description "Kodak Photo CD image"
  583.  
  584.      or
  585.  
  586.          description "TIFF image"
  587.  
  588.  
  589.  
  590.  
  591.                                                                         PPPPaaaaggggeeee 9999
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. IIIIFFFFLLLL((((3333))))            IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll             IIIIFFFFLLLL((((3333))))
  599.  
  600.  
  601.  
  602.      Descriptions should be relatively short as they are used as the labels
  603.      for GUI components in some applications.
  604.  
  605.      The dso declaration specifies that name of the DSO that contains the code
  606.      to read and/or write the format.  This name is typically specified
  607.      without a directory path; instead, the environment variable,
  608.      LLLLDDDD____LLLLIIIIBBBBRRRRAAAARRRRYYYY____PPPPAAAATTTTHHHH, is used to locate the DSO at run-time.
  609.  
  610.      The optional _a_c_c_e_s_s declaration determines what access modes are
  611.      supported for the format.  Possible values are: "readonly", "_w_r_i_t_e_o_n_l_y",
  612.      or the default, "readwrite".
  613.  
  614.      The optional subsystem _d_e_c_l_a_r_a_t_i_o_n _c_a_n _b_e _u_s_e_d _t_o _n_a_m_e _t_h_e _i_n_s_t _s_u_b-
  615.      _s_y_s_t_e_m _t_h_a_t _s_h_o_u_l_d _b_e _i_n_s_t_a_l_l_e_d _t_o _o_b_t_a_i_n _s_u_p_p_o_r_t _f_o_r _t_h_e _f_o_r_m_a_t.  _T_h_i_s
  616.      _n_a_m_e _i_s _i_n_c_l_u_d_e_d _i_n _e_r_r_o_r _m_e_s_s_a_g_e_s _w_h_e_n _t_h_e _D_S_O _f_o_r _a _f_o_r_m_a_t _c_a_n _n_o_t _b_e
  617.      _o_p_e_n_e_d.
  618.  
  619.      The optional suffixes _d_e_c_l_a_r_a_t_i_o_n _l_i_s_t_s _a _s_e_t _o_f _f_i_l_e _n_a_m_e _s_u_f_f_i_x_e_s _t_h_a_t
  620.      _w_i_l_l _b_e _u_s_e_d _t_o _d_e_t_e_r_m_i_n_e_d _w_h_a_t _f_o_r_m_a_t _a _n_e_w_l_y _c_r_e_a_t_e_d _f_i_l_e _s_h_o_u_l_d _u_s_e
  621.      _w_h_e_n _t_h_e _f_o_r_m_a_t _i_s _n_o_t _s_p_e_c_i_f_i_e_d _i_n _a_n iiiiffffllllFFFFiiiilllleeee::::::::ccccrrrreeeeaaaatttteeee() _c_a_l_l.  _A _t_y_p_i_c_a_l
  622.      _s_u_f_f_i_x_e_s rrrruuuulllleeee wwwwoooouuuulllldddd bbbbeeee::::
  623.  
  624.          ssssuuuuffffffffiiiixxxxeeeessss ....jjjjppppgggg,,,,....jjjjppppeeeegggg
  625.  
  626.  
  627.      Comments may be placed in a database file by using the '!' character.
  628.      The comment extends to the end of the line.
  629.  
  630.      Other files (like /usr/lib/ifl/ifl_database) can be included in a
  631.      database file using the "#include" directive.  This directive uses the
  632.      same syntax as the C preprocessor equivalent; the "#" must be the first
  633.      character on a line and the filename must be enclosed in quotes or
  634.      angle-brackets:
  635.  
  636.          #include "filename"
  637.  
  638.      or
  639.  
  640.          #include <filename>
  641.  
  642.      The filename must be an absolute pathname (i.e. it must start with a
  643.      "/").
  644.  
  645.  
  646. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  647.      iflFile(3), iflFormat(3), iflSize(3), IFL(1), <ifl/iflTypes.h>, IL(1)
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                                                        PPPPaaaaggggeeee 11110000
  658.  
  659.  
  660.  
  661.